#include <windows.h> 
#include <stdio.h>
#include <stdint.h>
#include <tchar.h>
#include "Window_Timer.h"


Window_Timer Win_Timer = {0, NULL};

 
//事件对象
// HANDLE g_Event = NULL;
HANDLE hTimerQueue = NULL;

 
VOID CALLBACK TimerRoutine(PVOID lpParameter, BOOLEAN TimerOrWaitFired)
{
    static uint32_t count;

	if(NULL == lpParameter)
	{
		OutputDebugString(_T("lpParameter is null。。"));
		return;
	}
    if(Win_Timer.Inter != NULL)
    {
        Win_Timer.Inter();
    }
}
 
 
void Windows_Timer_Init(void)
{
	HANDLE hTimer= NULL;
	int arg = 123;
 
	hTimerQueue = CreateTimerQueue();
	if(hTimerQueue == NULL)
	{
		OutputDebugString(_T("CreateTimerQueue失败。。"));
		return 1;
	}
	if(!CreateTimerQueueTimer(&hTimer,hTimerQueue,TimerRoutine,&arg,0,Win_Timer.Tick_ms,NULL))
	{
		OutputDebugString(_T("CreateTimerQueueTimer失败。。"));
		return 1;
	}
}

void Win_Timer_Delete(void)
{
	if(!DeleteTimerQueue(hTimerQueue))
	{
		OutputDebugString(_T("DeleteTimerQueue失败。。"));
	}
}
